package cn.kys.modules.system.controller;


import cn.kys.modules.system.service.ToolsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/tools")
public class ToolsApi {

    @Autowired
    private ToolsService toolsService;


    @GetMapping(value="/filter")
    public Object filter() {

        Map returnMap = new HashMap();

        try {
            toolsService.filter();
            returnMap.put("success",true);
            returnMap.put("resMsg","成功");
        } catch (Exception e) {
            e.printStackTrace();
            returnMap.put("success",false);
            returnMap.put("resMsg","异常");
        }

        return returnMap;
    }


    @GetMapping(value="/filterCrops")
    public Object filterCrops() {

        Map returnMap = new HashMap();

        try {
            toolsService.filterCrops();
            returnMap.put("success",true);
            returnMap.put("resMsg","成功");
        } catch (Exception e) {
            e.printStackTrace();
            returnMap.put("success",false);
            returnMap.put("resMsg","异常");
        }

        return returnMap;
    }


}
